package com.lld.crowdfunding.handler;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 全局异常处理类
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public String exceptioinHandler(HttpServletRequest request, HttpServletResponse response, Model model,Exception e) {
        model.addAttribute("message",e.getMessage());
        return "500";
    }
}
